﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace Hyunhdai_Saigon_Project
{
    public partial class San_Pham : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                String hx = Request.QueryString["hx"];
                lblHangXe.Text = getNameHangXe(int.Parse(hx));
            }
            catch (Exception)
            {
                lblHangXe.Text = "Tất Cả Hãng Xe";
            }

        }
        public String getNameHangXe(int id)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["hyundaisaigonConnectionString"].ConnectionString);
            connection.Open();
            
                string sql = "select name from nhasanxuat where id = " + (id.ToString());
            
            SqlDataAdapter da = new SqlDataAdapter(sql, connection);
            DataTable dt = new DataTable();
            da.Fill(dt);
            String result = dt.Rows[0][0].ToString();
            connection.Close();
            return result;

        }

    }
}